// 导入articleModel.js模块
const articleModel = require("../models/articleModel.js")
// 文章类
class Article {
    // 发布文章
    publish(title, author, cate, cate_name, content, src, tag) {
        // 获取日期时间
        const date = new Date().toLocaleString()
        const createAt = date
        return articleModel.publish(title, author, cate, cate_name, content, src, tag, createAt)
    }
    // 删除文章
    remove(id) {
        return articleModel.remove(id)
    }
    list() {
        return articleModel.list()
    }
    // 文章列表
    items(page_num, page_size) {
        return articleModel.items(page_num, page_size)
    }
    // 修改文章
    modify(title, author, cate, cate_name, content, src, tag, id) {
        return articleModel.modify(title, author, cate, cate_name, content, src, tag, id)
    }
    // 搜索文章
    search(keyword) {
        return articleModel.search(keyword)
    }
    // 查看文章详情
    detail(id) {
        return articleModel.detail(id)
    }

}

// 暴露文章类
module.exports = Article;